import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DividendRecordVO, DividendRecordForm, DividendRecordQuery } from '@/api/device/dividendRecord/types';

/**
 * 查询管理员分润记录列表
 * @param query
 * @returns {*}
 */

export const listDividendRecord = (query?: DividendRecordQuery): AxiosPromise<DividendRecordVO[]> => {
  return request({
    url: '/device/dividendRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询管理员分润记录详细
 * @param dividendId
 */
export const getDividendRecord = (dividendId: string | number): AxiosPromise<DividendRecordVO> => {
  return request({
    url: '/device/dividendRecord/' + dividendId,
    method: 'get'
  });
};

/**
 * 新增管理员分润记录
 * @param data
 */
export const addDividendRecord = (data: DividendRecordForm) => {
  return request({
    url: '/device/dividendRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改管理员分润记录
 * @param data
 */
export const updateDividendRecord = (data: DividendRecordForm) => {
  return request({
    url: '/device/dividendRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除管理员分润记录
 * @param dividendId
 */
export const delDividendRecord = (dividendId: string | number | Array<string | number>) => {
  return request({
    url: '/device/dividendRecord/' + dividendId,
    method: 'delete'
  });
};
